
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/10 14:40
 */

#include "iostream"
#include "cstring"
#include "algorithm"

using namespace std;

int main() {
    int n;
    cin >> n;
    int const N = 10010;
    int cnt[N] = {0};
    int tmp;

    while (n--) {
        cin >> tmp;
        cnt[tmp]++;
    }

    int id = 0;
    int num = -1;

    for (int i = 1; i < N; ++i) {
        if (cnt[i] > num) {
            id = i;
            num = cnt[i];
        }
    }

    cout << id;

    return 0;
}